package soar.template.springboot.service.hello.configuration.threadpool;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean;

@Configuration
class MyThreadPoolConfiguration
{
    @Bean
    public ThreadPoolExecutorFactoryBean threadPoolExecutorFactory()
    {
        ThreadPoolExecutorFactoryBean factory = new ThreadPoolExecutorFactoryBean();
        factory.setCorePoolSize(10);
        // factory.setMaxPoolSize(100);
        // factory.setQueueCapacity(5); // 队列满会增加线程，缺省Integer.MAX_VALUE，因此不会增加线程
        return factory;
    }
}
